package com.soap.controller;


import com.soap.service.UserPermissionService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 *
 * 用户权限对应表
 *
 * @author ZhangPY
 * @since 2020-06-15
 */
@RestController
@RequestMapping("/userPermission")
public class UserPermissionController {

    @Autowired
    private UserPermissionService userPermissionService;

    @ApiOperation(value = "获取权限树")
    @RequestMapping(value = "/getUserPermissions" , method = RequestMethod.POST)
    public String getUserPermissions(Long userId) {

        return userPermissionService.getUserPermissions(userId);
    }


    @ApiOperation(value = "获取权限集合")
    @RequestMapping(value = "/getUserPermissionsList" , method = RequestMethod.POST)
    public String getUserPermissionsList(Long userId) {

        return userPermissionService.getUserPermissionsList(userId);
    }


    @ApiOperation(value = "获取权限树")
    @RequestMapping(value = "/getUserPermissionsGet" , method = RequestMethod.GET)
    public String getUserPermissionsGet(Long userId) {

        return userPermissionService.getUserPermissions(userId);
    }

    @ApiOperation(value = "更新权限树")
    @RequestMapping(value = "/updateUserPermissions" , method = RequestMethod.POST)
    public String updateUserPermissions(Long userId , String permissionsId) {

        return userPermissionService.updateUserPermissions(userId , permissionsId);
    }

}
